/* Copyright 2014 Jan Wolter */
/* Substitute BSD random number generator for David Bau's ARC 4 generator. */
#include <stdlib.h>
#include "stack.h"

void randseed(char *seed)
{
    unsigned int s= strtoul(seed, NULL, 10);
    srandom(s);
}

int randint(int n)
{
    int d= RAND_MAX/n;
    int r;

    do {
	r= random() / d;
    } while (r >= n);
    return r;
}
